<template>
  <div class="distribue-cus">
    <slot name="title"></slot>
    <el-radio-group v-model="distribute" class="dis-radio">
      <el-radio :label="0">不分配</el-radio>
      <el-radio :label="1">分配到人员</el-radio>
    </el-radio-group>
    <distribute-form v-if="distribute" ref="disForm"></distribute-form>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref, getCurrentInstance } from 'vue'
import distributeForm from './form.vue'
export default defineComponent({
  name: 'DistributeCus',
  components: { distributeForm },
  setup() {
    const distribute = ref(0)

    const instance: any = getCurrentInstance()

    const check = () => {
      if (!distribute.value) {
        return
      }
      return instance?.refs.disForm.checkForm()
    }

    return {
      check,
      distribute
    }
  }
})
</script>

<style lang="stylus" scoped>
.distribue-cus
  .dis-radio
    margin-bottom 16px
  .el-form
    display: flex
</style>
